<?php
		if(isset($_COOKIE['name'])){
			
		}else{
			echo '<h3>您是非法登陆哟！</h3>';
			header("Refresh:1;login.html");
			exit;
		}
?>
<?php
		if(isset($_POST['jishi'])&&!$_POST['jishi'] == "")
		{
			//进行数据的写入
			$servername = "localhost";
			$username = "root";
			$password = "";
			$dbname = "dyd";
			$conn = new mysqli($servername, $username, $password,$dbname);
			 
			// 检测连接
			if ($conn->connect_error) 
			{
			    die("连接失败: " . $conn->connect_error);
			} 
			$sql = "insert into a_notepad set note_content =' ".$_POST['jishi']."',note_writer = '".$_COOKIE['name']."';";
			//echo $sql;
			
			if($conn->query($sql))
			{
				echo "<script>alert('提交成功！');</script>";
				//释放
				$conn->close();
			}
			else
			{
				echo "<script>alert('提交失败！');</script>";
			}
			header("Refresh:0;notepad.php");
			exit;
		} 
		else
		{
			echo "<script>alert('没有内容！');</script>";
			header("Refresh:0;notepad_xie.php");
			exit;
		}
		
		
?>

	